<?php


namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Watson\Validating\ValidatingTrait;
class Company extends Model
{
    use  Notifiable;
    use ValidatingTrait;
    use SoftDeletes;
    protected $table = 'companys';
    //
    protected $fillable = [
        'name', 'phone'
    ];
    protected $rules = [
        'name' => 'required|max:20|unique:companys',
        'phone'=>'required|integer|max:11|unique:companys',
    ];


    protected $validationMessages = [
        'name.required' => '科室名称必填',
        'name.max' => '科室名长度不得超过20个字符',
        'name.unique' => '该科室名已经被注册过了',
        'phone.required' => '科室电话必填',
        'phone.max' => '科室电话长度不得超过11个数字',
        'phone.unique' => '该电话已被注册',
        'phone.integer'=>'科室电话必须是数字组成'
    ];
}
